<?php
/**
 * Joomla! 1.5 component NS Pro
 *
 * @version $Id: view.html.php 2009-04-28 01:47:12 svn $
 * @author Christopher Mavros
 * @package Joomla
 * @subpackage NS Pro
 * @license GNU/GPL
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

// Import Joomla! libraries
jimport( 'joomla.application.component.view');
class NsproViewDefault extends JView {

    function display($tpl = null)
    {

        //global $mainframe, $option;
        $mainframe = JFactory::getApplication();
        $option = JRequest::getCmd('option');
        
        $model      =& $this->getModel();
        $limit      = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
        $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' );

        //JToolBarHelper::title(   JText::_( 'NS Pro Manager' ), 'generic.png' );
        JToolBarHelper::publishList();
        JToolBarHelper::unpublishList();
        JToolBarHelper::deleteList('Are you sure you want to delete all selected items?', 'lremove', 'Delete');
        JToolBarHelper::editListX('ledit', 'Edit');
        JToolBarHelper::addNewX('ledit', 'New');
        JToolBarHelper::preferences('com_nspro', 400);
        JToolBarHelper::help('../../help.html', true);

        jimport('joomla.html.pagination');
        $total = $model->getListCount();

        $pagination = new JPagination( $total, $limitstart, $limit );
        $this->assignRef('pagination',  $pagination);

        $lists = $model->getLists($limit, $limitstart);
        $this->assignRef('lists', $lists);

        $listCount = $model->getListCount($limit, $limitstart);
        $this->assignRef('listCount', $listCount);

        $state =& $this->get( 'state' );
        $olists['order_Dir'] = $state->get( 'lst.filter_order_Dir' );
        $olists['order']     = $state->get( 'lst.filter_order' );
        $this->assignRef( 'olists', $olists );

        parent::display($tpl);
    }
}
?>